#ifndef PH_RB_TREE_H
#define PH_RB_TREE_H

#include <unistd.h>
#include <string.h>

struct ph_rb_tree_t;

typedef struct ph_rb_tree_t ph_rb_tree_t;

typedef ph_rb_tree_t rbt_t;

rbt_t * rbt_create();

int rbt_release(rbt_t *rbt);

int rbt_put(rbt_t *rbt, void *k, size_t kl, void *v, size_t vl);
int rbt_get(rbt_t *rbt, void *k, size_t kl, void **v, size_t *vl);
int rbt_del(rbt_t *rbt, void *k, size_t lk, void **v, size_t *vl);

int rbt_foreach(rbt_t *rbt, int (*f)(void *ctx), void *ctx);

void rbt_print(rbt_t *rbt);

#endif /* PH_RB_TREE_H */
